
<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Datatables</title>

    <!-- Main Styles -->
    <link rel="stylesheet" href="../../static/styles/style.min.css">

    <!-- Material Design Icon -->
    <link rel="stylesheet" href="../../static/fonts/material-design/css/materialdesignicons.css">

    <!-- mCustomScrollbar -->
    <link rel="stylesheet" href="../../static/plugin/mCustomScrollbar/jquery.mCustomScrollbar.min.css">

    <!-- Waves Effect -->
    <link rel="stylesheet" href="../../static/plugin/waves/waves.min.css">

    <!-- Sweet Alert -->
    <link rel="stylesheet" href="../../static/plugin/sweet-alert/sweetalert.css">

    <!-- Data Tables -->
    <link rel="stylesheet" href="../../static/plugin/datatables/media/css/dataTables.bootstrap.min.css">
    <link rel="stylesheet" href="../../static/plugin/datatables/extensions/Responsive/css/responsive.bootstrap.min.css">

    <!-- Dark Themes -->
    <!--    <link rel="stylesheet" href="../../static/styles/style-black.min.css">-->
</head>

<body>
<div id="page1">
</div>

<div id="notification-popup" class="notice-popup js__toggle" data-space="75">
    <h2 class="popup-title">Your Notifications</h2>
    <!-- /.popup-title -->
    <div class="content">
        <ul class="notice-list">
            <li>
                <a href="#">
                    <span class="avatar"><img src="../../static/images/avatar-sm-1.jpg" alt=""></span>
                    <span class="name">John Doe</span>
                    <span class="desc">Like your post: “Contact Form 7 Multi-Step”</span>
                    <span class="time">10 min</span>
                </a>
            </li>
            <li>
                <a href="#">
                    <span class="avatar"><img src="../../static/images/avatar-sm-2.jpg" alt=""></span>
                    <span class="name">Anna William</span>
                    <span class="desc">Like your post: “Facebook Messenger”</span>
                    <span class="time">15 min</span>
                </a>
            </li>
            <li>
                <a href="#">
                    <span class="avatar bg-warning"><i class="fa fa-warning"></i></span>
                    <span class="name">Update Status</span>
                    <span class="desc">Failed to get available update data. To ensure the please contact us.</span>
                    <span class="time">30 min</span>
                </a>
            </li>
            <li>
                <a href="#">
                    <span class="avatar"><img src="../../static/images/avatar-1.jpg" alt=""></span>
                    <span class="name">Jennifer</span>
                    <span class="desc">Like your post: “Contact Form 7 Multi-Step”</span>
                    <span class="time">45 min</span>
                </a>
            </li>
            <li>
                <a href="#">
                    <span class="avatar"><img src="../../static/images/avatar-sm-6.jpg" alt=""></span>
                    <span class="name">Michael Zenaty</span>
                    <span class="desc">Like your post: “Contact Form 7 Multi-Step”</span>
                    <span class="time">50 min</span>
                </a>
            </li>
            <li>
                <a href="#">
                    <span class="avatar"><img src="../../static/images/avatar-sm-4.jpg" alt=""></span>
                    <span class="name">Simon</span>
                    <span class="desc">Like your post: “Facebook Messenger”</span>
                    <span class="time">1 hour</span>
                </a>
            </li>
            <li>
                <a href="#">
                    <span class="avatar bg-violet"><i class="fa fa-flag"></i></span>
                    <span class="name">Account Contact Change</span>
                    <span class="desc">A contact detail associated with your account has been changed.</span>
                    <span class="time">2 hours</span>
                </a>
            </li>
            <li>
                <a href="#">
                    <span class="avatar"><img src="../../static/images/avatar-sm-7.jpg" alt=""></span>
                    <span class="name">Helen 987</span>
                    <span class="desc">Like your post: “Facebook Messenger”</span>
                    <span class="time">Yesterday</span>
                </a>
            </li>
            <li>
                <a href="#">
                    <span class="avatar"><img src="../../static/images/avatar-2.jpg" alt=""></span>
                    <span class="name">Denise Jenny</span>
                    <span class="desc">Like your post: “Contact Form 7 Multi-Step”</span>
                    <span class="time">Oct, 28</span>
                </a>
            </li>
            <li>
                <a href="#">
                    <span class="avatar"><img src="../../static/images/avatar-sm-8.jpg" alt=""></span>
                    <span class="name">Thomas William</span>
                    <span class="desc">Like your post: “Facebook Messenger”</span>
                    <span class="time">Oct, 27</span>
                </a>
            </li>
        </ul>

        <a href="#" class="notice-read-more">See more messages <i class="fa fa-angle-down"></i></a>
    </div>

</div>


<div id="message-popup" class="notice-popup js__toggle" data-space="75">
    <h2 class="popup-title">Recent Messages<a href="#" class="pull-right text-danger">New message</a></h2>
    <!-- /.popup-title -->
    <div class="content">

    </div>

</div>


<div id="wrapper">
    <div class="main-content">
        <div class="row small-spacing">
            <div class="col-xs-12">
                <div class="box-content">
                    <h4 class="box-title">Default</h4>
                    <form class="form-inline" role="form" style="float:left;">
                        <div class="form-group has-feedback">
                            <div class="input-group input-group-sm">
                                <div class="input-group-addon" >订单状态</div>
                                <select type="text" class="form-control"  id="status"
                                        placeholder="请输入订单状态">
                                    <option >全部</option>
                                    <option >待审核</option>
                                    <option >审核通过</option>
                                    <option >审核未通过</option>
                                </select>
                                <div class="input-group-addon">车牌号</div>
                                <input type="text" class="form-control" id="rplate"  placeholder="请输入车牌号"></input>
                            </div>
                        </div>
                        <button type="button"  class="btn btn-xs btn-warning" id="Select" ><i class="glyphicon glyphicon-search"></i> 查询</button>
                    </form>

                    <table id="example" class="table table-striped table-bordered display" style="width:100%">
                        <thead>
                        <tr>
                            <th>编号</th>
                            <th>抢租客姓名</th>
                            <th>驾驶证</th>
                            <th>车牌照片</th>
                            <th>车牌</th>
                            <th>状态</th>
                            <th>审核</th>
                        </tr>
                        </thead>

                        <tbody id="tbody1">
                        </tbody>
                        <tfoot>
                        <tr>
                            <td colspan="7" align="center">
                                <ul class="pagination" id="byPage">

                                </ul>
                            </td>
                        </tr>

                        </tfoot>
                    </table>
                </div>

            </div>
        </div>

    </div>

</div><!--/#wrapper -->


<script src="../../static/scripts/jquery.min.js"></script>
<script src="../../static/scripts/modernizr.min.js"></script>
<script src="../../static/plugin/bootstrap/js/bootstrap.min.js"></script>
<script src="../../static/plugin/mCustomScrollbar/jquery.mCustomScrollbar.concat.min.js"></script>
<script src="../../static/plugin/nprogress/nprogress.js"></script>
<script src="../../static/plugin/sweet-alert/sweetalert.min.js"></script>
<script src="../../static/plugin/waves/waves.min.js"></script>

<!-- Data Tables -->
<script src="../../static/plugin/datatables/media/js/jquery.dataTables.min.js"></script>
<script src="../../static/plugin/datatables/media/js/dataTables.bootstrap.min.js"></script>
<script src="../../static/plugin/datatables/extensions/Responsive/js/dataTables.responsive.min.js"></script>
<script src="../../static/plugin/datatables/extensions/Responsive/js/responsive.bootstrap.min.js"></script>
<!--<script src="../../static/scripts/datatables.demo.min.js"></script>-->

<!--<script src="../../static/scripts/main.min.js"></script>-->
<script type="text/javascript">
    $(function () {

        $("#Select").click(function () {
            showByPage(1);
        });

        $(document).ready(function() {
            $("#page1").load("/menu");
        });
        showByPage(1);

    })

    function showByPage(pageNum){
        var status=$("#status").val();
        if(status=="全部"){
            status=null;
        }
        var rplate=$("#rplate").val();
        $.ajax({
            url : "/information/findAll",
            type : "post",
            data:{
                "pageNum":pageNum,
                "status":status,
                "rplate":rplate,
            },
            success : function(obj) {
                if (obj.result) {
                    var message = "";
                    $.each(obj.informationList,
                        function(index,information) {
                            message += "<tr>";
                            message += "<td>"+(index+1)+"</td>";
                            message += "<td>"+information.userInfo.uname+"</td>";
                            message += "<td><img src='"+information.driverimg+"'></td>";
                            message += "<td><img src='"+information.plateimg+"'></td>";
                            message += "<td>"+information.rplate+"</td>";
                            message += "<td>"+information.status+"</td>";
                            message += "<td>";
                            if (information.status!=null){
                                if (information.status=="待审核") {
                                    message += "<button type='button' class='btn btn-info  btn-rounded btn-xs waves-effect waves-light' onclick='statusBy(\""+information.iid+"\",\""+information.status+"\")'><i class='glyphicon glyphicon-ok'>通过</i></button>";
                                    message += "<button type='button' class='btn btn-danger btn-rounded btn-xs  waves-effect waves-light' onclick='statusFail(\""+information.iid+"\",\""+information.status+"\")'><i class='glyphicon glyphicon-ban-circle'>未通过</i></button>";
                                }}
                            message += "</td>";
                            message += "</tr>";
                        });
                    $("#tbody1").html(message);

                    var pageMessage = "";
                    pageMessage +='<li class="'+(obj.pageInfo.pageNum==1?"disabled":"")+'"><a onclick="showByPage('+obj.pageInfo.prePage+')">上一页</a></li>';
                    for(var i=1;i<=obj.pageInfo.pages;i++){
                        pageMessage +='<li class="'+(obj.pageInfo.pageNum==i?"active":"")+'"><a onclick="showByPage('+i+')">'+i+' <span class="sr-only">(current)</span></a></li>';
                    }
                    pageMessage +='<li class="'+(obj.pageInfo.pageNum==obj.pageInfo.pages?"disabled":"")+'"><a onclick="showByPage('+obj.pageInfo.nextPage+')">下一页</a></li>';
                    $("#byPage").html(pageMessage);
                }

            }

        });
    }

    // 审核通过
    function statusBy(iid,status) {
        if (status=="待审核"){
            var  status="审核通过";
            $.ajax({
                url: "/information/updateAudit",
                type: "post",
                data: {
                    "status": status,
                    "iid":iid,
                },
                success: function (data) {
                    window.location.href = "/information/informationList";
                }
            });
        }
    }



</script>
</body>
</html>